//
//  FirstViewController.m
//  觅影
//
//  Created by lanou on 16/4/13.
//  Copyright © 2016年  陶虹. All rights reserved.
//

#import "FirstViewController.h"
#import "RootViewController.h"
#import "RegisterViewController.h"
#import "AppDelegate.h"

@interface FirstViewController () <UIScrollViewDelegate>
@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;
@property (weak, nonatomic) IBOutlet UIPageControl *pageController;
@property (weak, nonatomic) IBOutlet UIImageView *thirdImageView;

@end

@implementation FirstViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.scrollView.delegate = self;
    
    [self.pageController addTarget:self action:@selector(pageAction:) forControlEvents:UIControlEventValueChanged];
}


- (void)pageAction:(UIPageControl *)page
{
    [self.scrollView setContentOffset:CGPointMake(KWIDTH * page.currentPage, 0)];
}


#pragma mark --- 结束减速的方法 ---
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
    self.pageController.currentPage = self.scrollView.contentOffset.x / KWIDTH;
}

#pragma mark --- 点击进入事件 ---
- (IBAction)enterButton:(id)sender
{
    RegisterViewController *registerVC = [[RegisterViewController alloc]init];
    [UIApplication sharedApplication].delegate.window.rootViewController = registerVC;
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
